﻿<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="Content-Style-Type" content="text/css" /><meta name="generator" content="Aspose.Words for .NET 15.1.0.0" /><title></title></head><body><div><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:center; widows:0"><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">第十章 撮合系统的实现</span></h1><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">1</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">撮合系统的简介</span></h1><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">撮合引擎是所有撮合交易系统的核心组件，不管是股票交易系统</span><span style="font-family:Consolas; font-size:10.5pt">——</span><span style="font-family:微软雅黑; font-size:10.5pt">包括现货交易、期货交易、期权交易等，还是数字货币交易系统</span><span style="font-family:Consolas; font-size:10.5pt">——</span><span style="font-family:微软雅黑; font-size:10.5pt">包括币币交易、合约交易、杠杆交易等，以及各种不同的贵金属交易系统、大宗商品交易系统等，虽然各种不同交易系统的交易标的不同，但只要都是采用撮合交易模式，都离不开撮合引擎。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.001.png" width="563" height="247" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /><img src="ed63ddf9-8285-4359-98a2-50771b23b654.002.png" width="242" height="162" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /><img src="ed63ddf9-8285-4359-98a2-50771b23b654.003.png" width="309" height="171" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">撮合引擎是可以具有通用性的，一套具有通用性的撮合引擎实现理论上可以应用到任何撮合交易系统中，而无需做任何代码上的调整。即是说，同一套撮合引擎实现，既可以应用在股票交易系统，也可以应用在数字货币交易系统，可以用于现货交易，也可以用于合约交易等。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">那么，一套具有通用性的撮合引擎应该具备哪些功能呢？确定该问题的答案之前，我们先简单梳理一下一个完整的交易流程是怎样的？一般会包括以下步骤：</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">1.</span><span style="font-family:微软雅黑; font-size:10.5pt">系统开放某个交易标的的交易功能。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">2.</span><span style="font-family:微软雅黑; font-size:10.5pt">用户提交该交易标的的买卖申报，即委托单。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">3.</span><span style="font-family:微软雅黑; font-size:10.5pt">系统验证委托单是否有效，包括交易标的是否处于可交易的状态、订单的价格和数量是否符合要求等。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">4.</span><span style="font-family:微软雅黑; font-size:10.5pt">确定该委托单的挂单</span><span style="font-family:Consolas; font-size:10.5pt">(Maker)</span><span style="font-family:微软雅黑; font-size:10.5pt">费率和吃单</span><span style="font-family:Consolas; font-size:10.5pt">(Taker)</span><span style="font-family:微软雅黑; font-size:10.5pt">费率。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">5.</span><span style="font-family:微软雅黑; font-size:10.5pt">检查用户的资产账户情况，包括账户状态是否交易受限，是否有足够资金用于下单等。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">6.</span><span style="font-family:微软雅黑; font-size:10.5pt">将详细的委托单数据持久化到数据库，并冻结用户账户中相应数量的资金。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">7.</span><span style="font-family:微软雅黑; font-size:10.5pt">将委托单进行撮合处理，即在交易委托账本</span><span style="font-family:Consolas; font-size:10.5pt">(OrderBook)</span><span style="font-family:微软雅黑; font-size:10.5pt">中寻找能与该委托单匹配成交的订单，匹配的结果可能是：全部成交、部分成交或无匹配。全部成交或部分成交时，可能在交易委托账本中存在一个或多个匹配的订单，即会产生一条或多条成交记录。当无匹配或部分成交时，委托单的部分数据包括剩余未成交的数量会暂时保存到交易委托账本中，等待与后续的委托单匹配撮合。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">8.</span><span style="font-family:微软雅黑; font-size:10.5pt">将撮合产生的成交记录持久化到数据库，并根据历史成交记录生成市场数据，如</span><span style="font-family:Consolas; font-size:10.5pt">K</span><span style="font-family:微软雅黑; font-size:10.5pt">线数据、今日涨跌幅等。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">9.</span><span style="font-family:微软雅黑; font-size:10.5pt">更新数据库中所有成交订单的委托单数据，以及更新订单用户的资产账户余额。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">10.</span><span style="font-family:微软雅黑; font-size:10.5pt">将更新的订单数据、市场数据等发送给到前台。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">整个交易流程中涉及到多个服务，包括用户服务、账户服务、订单服务、撮合服务、市场数据服务等。其中，只有第</span><span style="font-family:Consolas; font-size:10.5pt">7</span><span style="font-family:微软雅黑; font-size:10.5pt">步是撮合引擎处理的。从单一职责原则来说，撮合引擎就应该只做一件事，那就是负责撮合订单。撮合之前的委托单持久化、冻结资金等，以及撮合之后生成</span><span style="font-family:Consolas; font-size:10.5pt">K</span><span style="font-family:微软雅黑; font-size:10.5pt">线数据等，都不应该属于撮合引擎的职责。</span></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">2</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">撮合竞价的方式</span></h1><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">撮合竞价方式一般有两种，一是集合竞价，二是连续竞价。股票交易系统一般会在不同交易时间段采用不同的竞价方式，比如在开盘或收盘时采用集合竞价，从而产生开盘价或收盘价，其余时间采用连续竞价。而大多数字货币交易系统则没有集合竞价，只有连续竞价，开盘价一般是在开始交易之前就设定好的。</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">2.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">集合竞价</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">常见在开盘或收盘时采用集合竞价。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">所谓集合竞价，是指对一段时间内接收的买卖委托单一次性集中撮合的竞价方式。以深沪的股票交易系统为例，在每个交易日的 </span><span style="font-family:Consolas; font-size:10.5pt">9:15~9:25 </span><span style="font-family:微软雅黑; font-size:10.5pt">期间是集合竞价时间。在该时间段内，系统陆续接收到的委托单不会即时成交，而是先将所有委托单按照价格优先、时间优先的原则排序，并在此基础上，找出一个基准价格，使它能同时满足以下三个条件：</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt 21pt; orphans:0; text-align:justify; text-indent:-21pt; widows:0"><span style="font-family:Wingdings; font-size:10.5pt"></span><span style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><span style="font-family:微软雅黑; font-size:10.5pt">可实现</span><span style="font-family:微软雅黑; font-size:10.5pt; font-weight:bold">最大成交量</span><span style="font-family:微软雅黑; font-size:10.5pt">的价格；</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt 21pt; orphans:0; text-align:justify; text-indent:-21pt; widows:0"><span style="font-family:Wingdings; font-size:10.5pt"></span><span style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><span style="font-family:微软雅黑; font-size:10.5pt">高于该价格的买单与低于该价格的卖单能全部成交的价格；</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt 21pt; orphans:0; text-align:justify; text-indent:-21pt; widows:0"><span style="font-family:Wingdings; font-size:10.5pt"></span><span style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><span style="font-family:微软雅黑; font-size:10.5pt">与该价格相同的买方或卖方至少有一方全部成交的价格。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">在 </span><span style="font-family:Consolas; font-size:10.5pt">9:25 </span><span style="font-family:微软雅黑; font-size:10.5pt">分结束的时候，该基准价格就被确定为成交价格，所有高于该价格的买单与低于该价格的卖单都将以该价格成交。未能成交的委托单，则自动转入连续竞价。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">不过，如果满足以上三个条件的价格存在两个或两个以上呢？对此，深交所和上交所的处理方案有所不同，深交所会取距前</span><span style="font-family:微软雅黑; font-size:10.5pt; font-weight:bold">收盘价最近的价格为成交价</span><span style="font-family:微软雅黑; font-size:10.5pt">，而上交所则取使未成交量</span><span style="font-family:微软雅黑; font-size:10.5pt; font-weight:bold">最小的价格为成交价</span><span style="font-family:微软雅黑; font-size:10.5pt">，如果未成交量最小的价格仍不止一个，则取中间价为成交价。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">我们可以看出，</span><span style="font-family:微软雅黑; font-size:10.5pt">集合竞价的主要目的就是为了</span><span style="font-family:微软雅黑; font-size:10.5pt; font-weight:bold">确定开盘价或收盘价</span><span style="font-family:微软雅黑; font-size:10.5pt">。</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">2.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">限价竞价</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">所谓连续竞价，也是我们所熟悉的竞价方式，是指对买卖委托单逐笔连续撮合的竞价方式。用户的挂单，只要满足成交条件，就能即时成交。而集合竞价，则要等到最后一刻才会成交。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">连续竞价时，依然要满足价格优先、时间优先的成交原则：</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">1</span><span style="font-family:微软雅黑; font-size:10.5pt">．</span><span style="font-family:微软雅黑; font-size:10.5pt">价格优先：买单则价格较高者能优先成交，卖单则是价格较低者能优先成交。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">2</span><span style="font-family:微软雅黑; font-size:10.5pt">．</span><span style="font-family:微软雅黑; font-size:10.5pt">时间优先：买卖方向和价格相同的委托单，先申报的委托单会比后申报的委托单优先成交。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">另外，买入价必须大于或等于卖出价才能撮合成交。当买入价等于卖出价时，成交价就是买入价或卖出价。当买入价大于卖出价时，则还要参考前一笔成交价来确定最新成交价。假设买入价为 </span><span style="font-family:Consolas; font-size:10.5pt">B</span><span style="font-family:微软雅黑; font-size:10.5pt">，卖出价为 </span><span style="font-family:Consolas; font-size:10.5pt">S</span><span style="font-family:微软雅黑; font-size:10.5pt">，前一笔成交价为 </span><span style="font-family:Consolas; font-size:10.5pt">P</span><span style="font-family:微软雅黑; font-size:10.5pt">，最新成交价为 </span><span style="font-family:Consolas; font-size:10.5pt">N</span><span style="font-family:微软雅黑; font-size:10.5pt">，那么：</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt 21pt; orphans:0; text-align:justify; text-indent:-21pt; widows:0"><span style="font-family:Wingdings; font-size:10.5pt"></span><span style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><span style="font-family:微软雅黑; font-size:10.5pt">如果 </span><span style="font-family:Consolas; font-size:10.5pt">P &gt;= B</span><span style="font-family:微软雅黑; font-size:10.5pt">，则 </span><span style="font-family:Consolas; font-size:10.5pt">N = B</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt 21pt; orphans:0; text-align:justify; text-indent:-21pt; widows:0"><span style="font-family:Wingdings; font-size:10.5pt"></span><span style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><span style="font-family:微软雅黑; font-size:10.5pt">如果 </span><span style="font-family:Consolas; font-size:10.5pt">P &lt;= S</span><span style="font-family:微软雅黑; font-size:10.5pt">，则 </span><span style="font-family:Consolas; font-size:10.5pt">N = S</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt 21pt; orphans:0; text-align:justify; text-indent:-21pt; widows:0"><span style="font-family:Wingdings; font-size:10.5pt"></span><span style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><span style="font-family:微软雅黑; font-size:10.5pt">如果 </span><span style="font-family:Consolas; font-size:10.5pt">B &gt; P &gt; S</span><span style="font-family:微软雅黑; font-size:10.5pt">，则 </span><span style="font-family:Consolas; font-size:10.5pt">N = P</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt"> </span><span style="font-family:微软雅黑; font-size:10.5pt">一套通用的撮合引擎应该两种竞价方式都支持，但对于同一交易标的来说，两种竞价方式不能同时进行，因此设计上需要考虑如何在两种竞价方式之间切换，具体的实现思路在后续章节我们再展开来讲。</span></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">3</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">质量要求</span></h1><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">我们的撮合引擎除了要满足以上所说的功能需求，还应该满足一些质量需求，尤其对可用性、可伸缩性和性能的要求较高。另外，为了达到通用，也要满足可复用性的需求。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">先说下可复用性，我们期望的是该撮合引擎既能用于股票交易系统，也能用于数字货币交易系统，既能用于币币交易，也能用于合约交易。因此，该撮合引擎要避免引入与具体系统强相关的业务逻辑，以加强它的可复用性。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">再看看性能，要衡量一个撮合引擎的性能，就看它处理每个交易对的 </span><span style="font-family:Consolas; font-size:10.5pt">TPS </span><span style="font-family:微软雅黑; font-size:10.5pt">有多高，即每秒钟能处理多少笔相同交易对的委托单。以前，基于数据库的撮合技术，</span><span style="font-family:Consolas; font-size:10.5pt">TPS </span><span style="font-family:微软雅黑; font-size:10.5pt">一般只有</span><span style="font-family:Consolas; font-size:10.5pt">10</span><span style="font-family:微软雅黑; font-size:10.5pt">笔</span><span style="font-family:Consolas; font-size:10.5pt">/</span><span style="font-family:微软雅黑; font-size:10.5pt">秒。而现在基本都是采用内存撮合技术，</span><span style="font-family:Consolas; font-size:10.5pt">TPS </span><span style="font-family:微软雅黑; font-size:10.5pt">很容易就能达到</span><span style="font-family:Consolas; font-size:10.5pt">1000</span><span style="font-family:微软雅黑; font-size:10.5pt">笔</span><span style="font-family:Consolas; font-size:10.5pt">/</span><span style="font-family:微软雅黑; font-size:10.5pt">秒，如果使用独占的高性能服务器，</span><span style="font-family:Consolas; font-size:10.5pt">1</span><span style="font-family:微软雅黑; font-size:10.5pt">万笔</span><span style="font-family:Consolas; font-size:10.5pt">/</span><span style="font-family:微软雅黑; font-size:10.5pt">秒甚至更高的 </span><span style="font-family:Consolas; font-size:10.5pt">TPS </span><span style="font-family:微软雅黑; font-size:10.5pt">都不难达到。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">接着谈谈可伸缩性，我们的每一个撮合引擎既可以同时处理多个交易标的，也可以只处理单个交易标的。当交易标的和并发量增多的时候，可以增加服务器，部署成撮合引擎集群，分别用来处理不同的交易标的，从而能够实现负载均衡。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">最后聊聊可用性，高可用主要体现在两点，一是故障率要低，二是对故障维修的时间要短。要降低故障率，那撮合引擎就需要有较高的健壮性，对于可能导致引擎出故障的各种异常情况要考虑好并设计好解决方案。另外，还可以采用多机热备份技术来提高可用性，而且要保证互备服务器之间的数据一致，那就需要引入内存状态机复制方案，实现上会复杂很多。</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">不过，我们并非一下子就要达到很高的质量要求，因为要求越高，其架构和实现会越复杂。我们可以先从简单的版本开始，然后不断升级迭代。</span></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">4</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">数据的流转方式</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">4.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">数据的流转方向</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.004.png" width="553" height="449" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">4.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">代码的实现</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.2.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">准备</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">RocketMQ</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">参考</span><span style="font-family:Consolas; font-size:10.5pt">:02_</span><span style="font-family:微软雅黑; font-size:10.5pt">环境的搭建</span><span style="font-family:Consolas; font-size:10.5pt">_</span><span style="font-family:微软雅黑; font-size:10.5pt">文档</span><span style="font-family:Consolas; font-size:10.5pt">_</span><span style="font-family:微软雅黑; font-size:10.5pt">五</span><span style="font-family:Consolas; font-size:10.5pt">_RocketMQ</span><span style="font-family:微软雅黑; font-size:10.5pt">的</span><span style="font-family:Consolas; font-size:10.5pt">Docker</span><span style="font-family:微软雅黑; font-size:10.5pt">安装</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">访问</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">http://</span><span style="color:#0000ff; font-family:Consolas; font-size:10.5pt; vertical-align:baseline">rocket-server</span><span style="color:#0000ff; font-family:Consolas; font-size:10.5pt; vertical-align:baseline">:8080/</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.005.png" width="553" height="104" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">若不能访问</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">看看自己的</span><span style="font-family:Consolas; font-size:10.5pt">host</span><span style="font-family:微软雅黑; font-size:10.5pt">文件是否正确</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">192.168.1.33 nacos-server</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">192.168.1.33 sentinel-server</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">192.168.1.33 seata-server</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">192.168.1.33 mysql-server</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">192.168.1.33 mongo-server</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">192.168.1.33 redis-server</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="color:#0000ff; font-family:Consolas; font-size:10.5pt; vertical-align:baseline">192.168.1.33 rocket-server</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.2.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">项目添加依赖</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">(</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">供数据的流转</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">)</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">打开</span><span style="font-family:Consolas; font-size:10.5pt">match-service</span><span style="font-family:微软雅黑; font-size:10.5pt">里面的</span><span style="font-family:Consolas; font-size:10.5pt">pom.xml</span><span style="font-family:微软雅黑; font-size:10.5pt">文件</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">添加以下依赖</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">&lt;!--        disruptor </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">高速队列</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">--&gt;</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;com.lmax&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;disruptor&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        &lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">&lt;!--        cpu</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">亲和锁</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">--&gt;</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;net.openhft&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;affinity&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">version</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;${affinity.version}&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">version</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        &lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">&lt;!--        spring-cloud-stream-rocketmq--&gt;</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;com.alibaba.cloud&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;spring-cloud-stream-binder-rocketmq&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        &lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.2.3 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">准备启动类</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@SpringBootApplication</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@EnableDiscoveryClient</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">MatchServiceApplication </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">public static void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10.5pt">main</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">[] args) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">SpringApplication</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt; font-style:italic">run</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">MatchServiceApplication</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">class </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">,args) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">}</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.2.4 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">准备配置文件</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">spring</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">application</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">name</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: match-service</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">profiles</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">active</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: dev</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">cloud</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">nacos</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">server-addr</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: nacos-server:8848</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">config</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">file-extension</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: yaml</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">#      </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">去</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic"> nacos-server </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">里面拉取</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic"> match-service-dev.yaml</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">4.3 Disruptor</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">和</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">SpringBoot</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">的整合</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.3.1 DisruptorProperties </span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Data</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">DisruptorProperties </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public static final </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt; font-style:italic">PREFIX </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"spring.disruptor"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">//          RingBuffer</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">缓冲区大小</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">, </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">默认</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> 1024 * 1024</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">ringBufferSize </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">1024 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">* </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">1024</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">是否为多生产者，如果是则通过 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">RingBuffer.createMultiProducer</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">创建一个多生产者的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">RingBuffer</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">，否则通过</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">RingBuffer.createSingleProducer</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">创建一个单生产者的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">RingBuffer</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private boolean </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">multiProducer </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">false</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.3.2 DisruptorHandlerException</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">异常处理</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">DisruptorHandlerException </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">ExceptionHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Object</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt; {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Logger </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">logger </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">LoggerFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt; font-style:italic">getLogger</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">DisruptorHandlerException</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">handleEventException</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Throwable </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">ex, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sequence, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Object </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">event) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        ex.printStackTrace();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">logger</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.error(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"process data error sequence ==[{}] event==[{}] ,ex ==[{}]"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, sequence, event.toString(), ex.getMessage());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">handleOnStartException</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Throwable </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">ex) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">logger</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.error(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"start disruptor error ==[{}]!"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, ex.getMessage());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">handleOnShutdownException</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Throwable </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">ex) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">logger</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.error(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"shutdown disruptor error ==[{}]!"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, ex.getMessage());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.3.3 OrderEvent </span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Serializable </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private static final long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">serialVersionUID </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">5516075349620653480L</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">时间戳</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private final long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">timestamp</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">事件携带的对象</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">protected transient </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Object </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Object </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">source) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">timestamp </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">System</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">currentTimeMillis</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">source </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= source;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">timestamp </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">System</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">currentTimeMillis</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderEvent </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Serializable </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private static final long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">serialVersionUID </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">5516075349620653480L</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">时间戳</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private final long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">timestamp</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">事件携带的对象</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">protected transient </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Object </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Object </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">source) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">timestamp </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">System</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">currentTimeMillis</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">source </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= source;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">timestamp </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">System</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">currentTimeMillis</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * Clearing Objects From the Ring Buffer</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">clear</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">source </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public long </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">getTimestamp</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">timestamp</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Object </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">getSource</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">setSource</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Object </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">source) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">source </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= source;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.3.4 Order</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">委托单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:7.5pt">@Data</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:7.5pt">@NoArgsConstructor</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Order </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Serializable </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">本次订单的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">Id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">orderId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">用户</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">会员</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">Id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">userId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">支持的币币交易对</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">买入或卖出量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">amount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">成交量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">tradedAmount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">成交额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">turnover </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">币单位</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">coinSymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">结算单位</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">baseSymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">订单状态</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Integer </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">orderStatus</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">订单的方向</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Integer </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">orderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">挂单的价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">price </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">挂单时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">time</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">交易完成时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">completedTime</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">交易取消时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">cancelTime</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">已经成功的水平订单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:7.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">OrderDetail</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">details</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">public boolean </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:7.5pt">isCompleted</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">       </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:7.5pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#008dde; font-family:Consolas; font-size:7.5pt; font-style:italic">TODO</span><br /><span style="background-color:#ffffff; color:#008dde; font-family:Consolas; font-size:7.5pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">return false </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">}</span></p><p style="font-size:5.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:5.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.3.5 OrderDetail</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Data</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderDetail </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">订单</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">Id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">orderId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">成交价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">price</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">成交数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">amount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">成交额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">turnover</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">费率</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">fee</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">成功时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">dealTime</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.3.6 DisruptorTemplate </span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">在</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">boot</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">里面使用它发送消息</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">DisruptorTemplate </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private static final </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EventTranslatorOneArg</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt; font-style:italic">TRANSLATOR </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">new </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EventTranslatorOneArg</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;() {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">translateTo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderEvent </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">event, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sequence, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">input) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">            event.setSource(input);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    };</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private final </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">RingBuffer</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">ringBuffer</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">DisruptorTemplate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">RingBuffer</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt; ringBuffer) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">ringBuffer </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= ringBuffer;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">onData</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">input) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">ringBuffer</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.publishEvent(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt; font-style:italic">TRANSLATOR</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, input);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.3.7 DisruptorAutoConfiguration </span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Configuration</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@EnableConfigurationProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(value = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DisruptorProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DisruptorAutoConfiguration </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DisruptorProperties </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">disruptorProperties </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">DisruptorAutoConfiguration</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DisruptorProperties </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">disruptorProperties){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">disruptorProperties </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= disruptorProperties ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Bean</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public  </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EventFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">eventEventFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(){</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EventFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderEventEventFactory </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EventFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">newInstance</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">OrderEvent() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        };</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return  </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderEventEventFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Bean</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ThreadFactory </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">threadFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">AffinityThreadFactory(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"Match-Handler:"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">无锁高效的等待策略</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Bean</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">WaitStrategy </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">waitStrategy</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">YieldingWaitStrategy();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">创建一个</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">RingBuffer</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * eventFactory: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">事件工厂</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* threadFactory:   </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">我们执行者</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">(</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">消费者</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">)</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的线程该怎么创建</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* waitStrategy : </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">等待策略</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">当我们</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">ringBuffer </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">没有数据时</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">我们怎么等待</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Bean</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RingBuffer</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">ringBuffer</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EventFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; eventFactory ,</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ThreadFactory </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">threadFactory ,</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">WaitStrategy </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">waitStrategy,</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; []eventHandlers</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                ){</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">         * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">构建</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">disruptor</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">         */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Disruptor</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; disruptor = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">null </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ProducerType </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">producerType = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ProducerType</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">SINGLE </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">disruptorProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.isMultiProducer()){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            producerType = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ProducerType</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">MULTI </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        disruptor = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">Disruptor&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;(eventFactory,</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">disruptorProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getRingBufferSize(),threadFactory,producerType,waitStrategy) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        disruptor.setDefaultExceptionHandler(</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">DisruptorHandlerException());</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置消费者</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">---</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">我们的每个消费者代表我们的一个交易对</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">有多少个交易对</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">我们就有多少个</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">eventHandlers ,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">事件来了后</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">多个</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">eventHandlers </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">是并发执行的</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">disruptor.handleEventsWith(eventHandlers) ;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RingBuffer</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ringBuffer </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= disruptor.getRingBuffer();</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        disruptor.start() ;</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">开始监听</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">final </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Disruptor</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">disruptorShutdown </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= disruptor ;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">使用优雅的停机</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Runtime</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">getRuntime</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">().addShutdownHook(</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">Thread(</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                ()-&gt;{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                    </span><span style="background-color:#ffffff; color:#851691; font-family:Consolas; font-size:9pt">disruptorShutdown</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.shutdown();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                },</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"DisruptorShutdownThread"</span><br /><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ringBuffer </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">创建</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">DisruptorTemplate</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">ringBuffer</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Bean</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DisruptorTemplate </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">disruptorTemplate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RingBuffer</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; ringBuffer){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">DisruptorTemplate(ringBuffer) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.3.8 OrderMatchDisruptorHandler </span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderMatchDisruptorHandler </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">EventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private static final </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Logger </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">LOG </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">LoggerFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">getLogger</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderMatchDisruptorHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">交给引擎去处理事件</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">event</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt; font-style:italic">Exception</span><br /><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">onEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderEvent </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">event, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">sequence, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">boolean </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">endOfBatch) </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= (</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) event.getSource();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">LOG</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"====&gt; </span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">开始接受委托单</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">{} &lt;======"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">toJSONString</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">try </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">catch </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">e) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">LOG</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.error(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">format</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">处理委托单：</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">%s </span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">发生了错误</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">toJSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)), e);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">finally </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">5</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">使用</span><span style="font-family:Consolas; font-size:22pt; font-weight:bold">SpringCloudStreamRocketMQ</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">5.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">创建一个</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">Sink</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public interface </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Sink </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Input</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"order.in"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MessageChannel </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">messageChannel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">5.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">创建监听器</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:7.5pt">@Service</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:7.5pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">MessageConsumerListener </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:7.5pt">@Autowired</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">DisruptorTemplate </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">disruptorTemplate </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:7.5pt">@StreamListener</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:7.5pt">"order.in"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:7.5pt">public  void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:7.5pt">handleMessage</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:7.5pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">order){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:7.5pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:7.5pt">接收到了委托单</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:7.5pt">:{}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">,order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:7.5pt">disruptorTemplate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">.onData(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:7.5pt">}</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">5.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">配置类</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">开启我们的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">Stream</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的开发</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Configuration</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@EnableBinding</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Sink</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RocketStreamConfig </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">6</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">委托单账本数据结构设计</span></h1><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.006.png" width="554" height="321" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">6.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">委托单的数据结构</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderBooks </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">买入的限价交易 价格从高到底</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* eg: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">价格越高，越容易买到</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* Key: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* MergeOrder </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">同价格的订单，订单按照时间排序</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">buyLimitPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">卖出的限价交易，价格从低到高</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* eg: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">价格越低，卖出的越容易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">sellLimitPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易的币种</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易币种的精度</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">coinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">基币的精度</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">baseCoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">日期格式器</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">SimpleDateFormat </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">dateTimeFormat</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span></p><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">6.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">合并订单的数据结构</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">订单的合并</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">LinkedList</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orders </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">LinkedList&lt;&gt;();</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">最后位置添加一个</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">add</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.addLast(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">   // </span><span style="background-color:#ffffff; color:#080808; font-family:宋体; font-size:9pt">从头获取数据</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">get</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.get(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public int </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">size</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.size();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.get(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">).getPrice();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.iterator();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getTotalAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">total = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">BigDecimal(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">for </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order item </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            total = total.add(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">item</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getAmount());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">total;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">6.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">订单的方向枚举</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public enum  </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">BUY</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">,</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">买入</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) ,</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">SELL</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">,</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">卖出</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) ;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">code </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">desc </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">code,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">desc){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">code </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= code ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">desc </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= desc ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public int </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getCode</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">code</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">setCode</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">code) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">code </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= code;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getDesc</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">desc</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">setDesc</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">desc) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">desc </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= desc;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public static </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getOrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">code){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">[] </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">values </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">values</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">for </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection value </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">values</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">value</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getCode()==code){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">value </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return null </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">6.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">需要实现的方法</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">6.4.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">初始化订单队列</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">初始化订单队列</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">initialize</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"init CoinTrader for symbol {}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">载入比较器</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">buyLimitPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">TreeMap&lt;&gt;(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Comparator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">reverseOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">价格从大到小</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">sellLimitPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">TreeMap&lt;&gt;(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Comparator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">naturalOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">价格从小到大</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">dateTimeFormat </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">SimpleDateFormat(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"yyyy-MM-dd HH:mm:ss"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">6.4.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">获取当前需要的交易队列</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">获取当前的交易队列</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">orderDirection </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易方向</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> */</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getCurrentOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderDirection){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderDirection == </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">BUY </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">? </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">buyLimitPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">sellLimitPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">6.4.3 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">获取当前需要的交易队列的迭代器</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">获取当前交易队列的迭代器</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic">orderDirection</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> */</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">getCurrentOrderIterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderDirection </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">orderDirection){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">return  </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">getCurrentOrders(orderDirection).entrySet().iterator();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">6.4.4 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">添加到交易队列里面</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">将订单添加到限价队列里面，限价队列的数据是使用价格和时间排序的</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">addOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">order) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">limitPriceMap </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= getCurrentOrders(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">getOrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(order.getOrderDirection()));</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">mergeOrder = </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">buyLimitPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.get(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">注意，此处均为单线程操作，无需考虑并发问题，当为集群或多线程时， 需要添加锁</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">分布式锁</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(mergeOrder == </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">之前不存在</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">mergeOrder = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">MergeOrder();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">之前的二叉树里面不存在该节点，插入进去</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">limitPriceMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(order.getPrice(), mergeOrder);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">添加到水平的订单里面</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">mergeOrder.add(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">6.4.5 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">添加到交易队列里面</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">从交易队列里面移除</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">cancelOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">获取当前要操作的数据容器</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">limitPriceMap </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">=</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">                    getCurrentOrders(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt; font-style:italic">getOrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(order.getOrderDirection())) ;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">MergeOrder mergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">limitPriceMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.get(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">mergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">== </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">null </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">|| </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">mergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.size() &lt;= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">iterator </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">mergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.iterator();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">while </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.hasNext()) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order each </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.next();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">each</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.getOrderId().equals(order.getOrderId())) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.remove(); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">移除该订单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">订单移除成功后，需要判断，移除此订单后，是否要移除之前的二叉树结点</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">mergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.size() &lt;= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">//O(1)</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">limitPriceMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.remove(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">6.4.6 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">获取排在队列里面的第一个数据</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">获取排在队列里面的第一个数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic">orderDirection</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> */</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">getBestSuitPriceMergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">OrderDirection </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">orderDirection){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">   </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">return </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">getCurrentOrders(orderDirection).firstEntry();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">6.4.7 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">构造器</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">OrderBooks</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">symbol){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(symbol,</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">4</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">,</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">4</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">OrderBooks</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">symbol,</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">coinScale,</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">baseCoinScale){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">symbol </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= symbol ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">coinScale </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= coinScale ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">coinScale </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= baseCoinScale ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.initialize();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">6.3 OrderBooks</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">的所有代码</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 12pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Data</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderBooks </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">买入的限价交易 价格从高到底</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* eg: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">价格越高，越容易买到</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* Key: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* MergeOrder </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">同价格的订单，订单按照时间排序</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">buyLimitPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">卖出的限价交易，价格从低到高</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* eg: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">价格越低，卖出的越容易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">sellLimitPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">交易的币种</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">交易币种的精度</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">coinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">基币的精度</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">baseCoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">日期格式器</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">SimpleDateFormat </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">dateTimeFormat</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">OrderBooks</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">symbol){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(symbol,</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">4</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">,</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">4</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">OrderBooks</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">symbol,</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">coinScale,</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">baseCoinScale){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">symbol </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= symbol ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">coinScale </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= coinScale ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">coinScale </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= baseCoinScale ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.initialize();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">初始化订单队列</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">initialize</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"init CoinTrader for symbol {}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">载入比较器</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">buyLimitPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">TreeMap&lt;&gt;(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Comparator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">reverseOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">价格从大到小</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">sellLimitPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">TreeMap&lt;&gt;(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Comparator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">naturalOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">价格从小到大</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">dateTimeFormat </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">SimpleDateFormat(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"yyyy-MM-dd HH:mm:ss"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">获取当前的交易队列</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">orderDirection </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">交易方向</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">getCurrentOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderDirection </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">orderDirection){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">orderDirection == </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">BUY </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">? </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">buyLimitPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">: </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">sellLimitPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">获取当前交易队列的迭代器</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">orderDirection</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt;&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">getCurrentOrderIterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderDirection </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">orderDirection){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return  </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">getCurrentOrders(orderDirection).entrySet().iterator();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">将订单添加到限价队列里面，限价队列的数据是使用价格和时间排序的</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">addOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">order) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">limitPriceMap </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= getCurrentOrders(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">getOrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(order.getOrderDirection()));</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">mergeOrder = </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">buyLimitPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.get(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">注意，此处均为单线程操作，无需考虑并发问题，当为集群或多线程时， 需要添加锁</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">分布式锁</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(mergeOrder == </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">之前不存在</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">mergeOrder = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">MergeOrder();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">之前的二叉树里面不存在该节点，插入进去</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">limitPriceMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.put(order.getPrice(), mergeOrder);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">添加到水平的订单里面</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">mergeOrder.add(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">从交易队列里面移除</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">cancelOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">         * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">获取当前要操作的数据容器</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">         </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">limitPriceMap </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">=</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                        getCurrentOrders(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">getOrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(order.getOrderDirection())) ;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder mergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">limitPriceMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.get(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">== </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">|| </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.size() &lt;= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.iterator();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">while </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.hasNext()) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order each </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.next();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">each</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getOrderId().equals(order.getOrderId())) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.remove(); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">移除该订单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">         * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">订单移除成功后，需要判断，移除此订单后，是否要移除之前的二叉树结点</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">         </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.size() &lt;= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//O(1)</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">limitPriceMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.remove(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">7</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">撮合引擎的实现</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">7.1 MatchEngineProperties</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@ConfigurationProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(prefix = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"spring.match"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchEngineProperties </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易对的信息</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">CoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">symbols </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public static  class  </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">CoinScale </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">         * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易币种的精度</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">         </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">coinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">         * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">基币的精度</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">         </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">baseCoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">7.2 MatchEnginAutoConfiguration</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Configuration</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@EnableConfigurationProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(value = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchEngineProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchEngineAutoConfiguration </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchEngineProperties </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">matchEngineProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">MatchEngineAutoConfiguration</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchEngineProperties </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">matchEngineProperties) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">matchEngineProperties </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= matchEngineProperties;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Bean</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"eventHandlers"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">EventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">[] </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">eventHandlers</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchEngineProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">CoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">symbols </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">matchEngineProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getSymbols();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Set</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchEngineProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">CoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt;&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entries </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">symbols</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.entrySet();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">EventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">[] </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">eventHandlers </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">EventHandler[</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">symbols</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.size()];</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">i = </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">for </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchEngineProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">CoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entry </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">: </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entries</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String symbol </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getKey();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchEngineProperties</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">CoinScale value </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getValue();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderBooks </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">orderBooks = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">value </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">!= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                orderBooks = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">OrderBooks(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">value</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getCoinScale(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">value</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getBaseCoinScale());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                orderBooks = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">OrderBooks(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">eventHandlers</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">[i++] = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">OrderEventHandler(orderBooks);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">eventHandlers</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">7.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">交易策略枚举</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">MatchStrategy</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public enum  </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MatchStrategy </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">限价交易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">LIMIT_PRICE </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">,</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">市场交易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">MARKER_PRICE </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:5.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:5.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">7.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">交易策略定义</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public interface </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">MatchService </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">执行撮合交易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">match</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">order) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Service</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">LimitPriceMatchServiceImpl </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">InitializingBean </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">进行订单的撮合交易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">match</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">开始撮合</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">afterPropertiesSet</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchServiceFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">addMatchService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchStrategy</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">LIMIT_PRICE</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">,</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">7.5 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">交易策略工厂</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">StrategyFactory</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchServiceFactory </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private static </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchStrategy</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">matchServiceMap </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">HashMap&lt;&gt;() ;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">给我们的策略工厂里面添加一个交易的实现类型</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">matchStrategy</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">matchService</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public static  void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">addMatchService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchStrategy </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">matchStrategy,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchService </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">matchService){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">matchServiceMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(matchStrategy ,matchService ) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">使用策略的名称获取具体的实现类</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">matchStrategy</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public static </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchService </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getMatchService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchStrategy </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">matchStrategy){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">matchServiceMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.get(matchStrategy) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">7.6 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">在</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">OrderEventHandler</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">调用某种交易策略</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.007.png" width="554" height="240" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">7.7 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">并发的情况思考</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">1 OrderEventHandler </span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">每个</span><span style="font-family:Consolas; font-size:10.5pt">Symbol </span><span style="font-family:微软雅黑; font-size:10.5pt">都有一个和它对应</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">它是个多例对象</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">但是我们在这个地方</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.008.png" width="553" height="325" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">2 OrderBooks </span><span style="font-family:微软雅黑; font-size:10.5pt">和一个交易对绑定</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">没有线程安全问题</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">3 MatchService </span><span style="font-family:微软雅黑; font-size:10.5pt">只有一个</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">若我们将</span><span style="font-family:Consolas; font-size:10.5pt">OrderBooks  </span><span style="font-family:微软雅黑; font-size:10.5pt">当成它的一个属性</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">就会有并发问题</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">因此</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">我们的这个参数使用方法传递过去</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.009.png" width="554" height="239" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">7.8 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">初始数据的加载</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Component</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">DataLoaderCmdLine </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">CommandLineRunner </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Autowired</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">DisruptorTemplate </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">disruptorTemplate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Autowired</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrderMapper </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">entrustOrderMapper</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">run</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">... args) </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">entrustOrders </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">=</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">                </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">entrustOrderMapper</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.selectList(</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">                        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">LambdaQueryWrapper&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;()</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">                                .eq(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">::getStatus, </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">                                .orderByAsc(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">::getCreated)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">                );</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">CollectionUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt; font-style:italic">isEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">entrustOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">for </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder entrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">entrustOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">                </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">disruptorTemplate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.onData(entrustOrder2Order(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">entrustOrder2Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">entrustOrder) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Order order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">Order();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setSymbol(entrustOrder.getSymbol()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">设置交易对</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setAmount(entrustOrder.getVolume().add(entrustOrder.getDeal().negate())); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">设置交易额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setPrice(entrustOrder.getPrice()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">设置交易价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setTime(entrustOrder.getCreated().getTime()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">设置交易时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setOrderId(entrustOrder.getId().toString()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">设置交易的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setOrderDirection(entrustOrder.getType().intValue()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">设置交易的方向</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">8</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">测试数据的流转</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">8.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加配置文件</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.010.png" width="553" height="254" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">内容为</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">server:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    port: 8050</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">spring:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    datasource:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        driver-class-name: com.mysql.cj.jdbc.Driver</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        url: jdbc:mysql://mysql-server:3307/coin-exchange?serverTimezone=GMT%2B8</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        username: root</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        password: Ltd3411??</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    redis:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        host: redis-server</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        port: 6380</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        password: Ltd3411??</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    cloud:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        sentinel:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            transport:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">                dashboard: sentinel-server:8858</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        alicloud:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            access-key: LTAI4GEXnLoaQg6UraLEJL1v</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            secret-key: txr1DH29usTcQo5MUSsDGoVBusQQHX</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            oss:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">               endpoint: oss-cn-beijing.aliyuncs.com</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">mybatis-plus:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    configuration:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    mapper-locations: classpath:/mappers/*Mapper.xml</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">jetcache:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    statIntervalMinutes: 15</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    areaInCacheName: false</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    local:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        default:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            type: linkedhashmap</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            keyConvertor: fastjson</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    remote:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        default:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            type: redis</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            keyConvertor: fastjson</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            valueEncoder: kryo</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            valueDecoder: kryo</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            poolConfig:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">                minIdle: 5</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">                maxIdle: 20</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">                maxTotal: 50</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            host: ${spring.redis.host}</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            port: ${spring.redis.port}</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            password: ${spring.redis.password}</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">swagger2:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    basePackage: com.bjsxt.controller</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    name: liangtiandong</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    url: www.liangtiandong.com</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    email: liangtiandong@live.com</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    title: </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">交易系统</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">API</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">接口</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">    </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">description: </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">交易系统</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">API</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">接口演示</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">    </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">version: 1.0</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    termsOfServiceUrl: www.bjsxt.com</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">geetest:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  geetest-id: 3a01ffc01c1d63b37c3dbe8ee9555290</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  geetest-key: 27c7b4a18124d5d649b9c58ca1830871</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">identify:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  url: https://idcert.market.alicloudapi.com/idcard?idCard=%s&amp;name=%s</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  appKey: 203866940</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  appSecret: KF6LRDKejSejx2vfyLqiLP7bVvWOZYCp</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  appCode: 39e89acacec14a9d80782d8aa2893295</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">8.2 RocketMq</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">的配置文件</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">stream</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">rocketmq</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">binder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">name-server</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: rocketmq-server:9876</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">binders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">order-in</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">consumer.orderly</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: true}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">bindings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">order-in</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: order-in, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: application/plain, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">group</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: order-group, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">consumer.maxAttempts</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">: 1}</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">8.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">新建</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">MatchController</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">获取数据</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@RestController</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchController </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Autowired</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;[] </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">eventHandlers</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@GetMapping</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"/match/order"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getTradeData</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(required = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">true</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">symbol, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(required = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">true</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Integer </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderDirection) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">for </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">eventHandler </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">eventHandlers</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEventHandler orderEventHandler </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= (</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">eventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderEventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getSymbol().equals(symbol)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderBooks orderBooks </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderEventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getOrderBooks();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderBooks</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getCurrentLimitPrices(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">getOrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(orderDirection));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">发现了</span><span style="font-family:Consolas; font-size:10.5pt">2 </span><span style="font-family:微软雅黑; font-size:10.5pt">处</span><span style="font-family:Consolas; font-size:10.5pt">Bug:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">OrderBooks:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.011.png" width="554" height="254" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:10.5pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">配置文件</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:10.5pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt"> </span><img src="ed63ddf9-8285-4359-98a2-50771b23b654.012.png" width="554" height="306" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:10.5pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">测试成功的效果</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:10.5pt; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.013.png" width="554" height="425" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">8.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">在</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">Exchange-Service </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">里面发送消息到消息队列测试</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">8.4.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">添加依赖</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">Exchange-Service</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">的</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">pom.xml</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">&lt;!--        spring-cloud-stream-rocketmq--&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">&gt;com.alibaba.cloud&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">&gt;spring-cloud-stream-binder-rocketmq&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">&gt;</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">8.4.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">配置文件</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">stream</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">bindings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">order_in</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: order_in, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: application/plain, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">group</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: order-group, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">consumer.maxAttempts</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: 1}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">rocketmq</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">binder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">name-server</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: rocket-server:9876</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">8.4.3 Source</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public interface </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Source </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Output</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"order_out"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">MessageChannel </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">outputMessage</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">8.4.4 RocketMQConfig</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@Configuration</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@EnableBinding</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(value = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">RocketMQConfig </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">}</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">8.4.5 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">在</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">EntrustOrderServiceImpl</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">发送消息</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.014.png" width="455" height="240" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">创建一个新的委托</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">userId     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">用户的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">orderParam </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">委托单的数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> */</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Override</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Boolean </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">createEntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">userId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderParam </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">orderParam) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// 1 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">层层校验</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@NotBlank </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String symbol </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= orderParam.getSymbol();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Market markerBySymbol </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">marketService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getMarkerBySymbol(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">==</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">IllegalArgumentException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">您购买的交易对不存在</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal price </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= orderParam.getPrice().setScale(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getPriceScale(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">RoundingMode</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">HALF_UP</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal volume </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= orderParam.getVolume().setScale(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getNumScale(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">RoundingMode</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">HALF_UP</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">计算成交额度</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal mum </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">price</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.multiply(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">volume</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">交易数量的交易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@NotNull </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal numMax </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getNumMax();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@NotNull </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal numMin </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getNumMin();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">volume</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">numMax</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)&gt;</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">|| </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">volume</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">numMin</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)&lt;</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">IllegalArgumentException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">交易的数量不在范围内</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">校验交易额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal tradeMin </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getTradeMin();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal tradeMax </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getTradeMax();</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mum</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">tradeMin</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)&lt;</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">|| </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mum</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">tradeMax</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)&gt;</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">IllegalArgumentException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">交易的额度不在范围内</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">计算手续费</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">fee = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">ZERO </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">feeRate = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">ZERO </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@NotNull </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Integer type </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= orderParam.getType();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">==</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">){ </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">买入</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> buy</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">feeRate = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getFeeBuy() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        fee = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mum</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.multiply(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getFeeBuy()) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">else</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{ </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">卖出</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> sell</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">feeRate = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getFeeSell() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        fee = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mum</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.multiply(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getFeeSell()) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">EntrustOrder entrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">EntrustOrder();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setUserId(userId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setAmount(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mum</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setType(orderParam.getType().byteValue());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setPrice(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">price</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setVolume(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">volume</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setFee(fee);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setCreated(</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">Date());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setStatus((</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">byte</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setMarketId(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setMarketName(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getName());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setMarketType(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getType());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setSymbol(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getSymbol());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setFeeRate(feeRate);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setDeal(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setFreeze(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getAmount().add(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getFee())); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">冻结余额</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">boolean </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">save </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= save(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">save</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">用户余额的扣减</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@NotNull </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">coinId = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">==</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">){ </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">购买操作</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">coinId  = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getBuyCoinId();</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">else</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            coinId = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">markerBySymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getSellCoinId() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">accountServiceFeign</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.lockUserAmount(userId,coinId,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getFreeze(),</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"trade_create"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getId(),fee);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">发送到撮合系统里面</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#0000ff; font-family:宋体; font-size:10pt; font-style:italic; font-weight:bold">   </span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">MessageBuilder&lt;EntrustOrder&gt; entrustOrderMessageBuilder = MessageBuilder.</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-style:italic; font-weight:bold">withPayload</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">(entrustOrder).setHeader(MessageHeaders.</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-style:italic; font-weight:bold">CONTENT_TYPE</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">, MimeTypeUtils.</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-style:italic; font-weight:bold">APPLICATION_JSON</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">);</span><br /><br /><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:11pt; font-weight:bold">        source.outputMessage().send(entrustOrderMessageBuilder.build());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">save </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">8.5 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">启动项目创建委托单</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">进行买入和卖出都是可以的</span><span style="font-family:Consolas; font-size:10.5pt">.</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.015.png" width="473" height="564" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">8.6 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">发送成功后</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.016.png" width="460" height="229" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">8.7 MatchService </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">代码改造</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">8.7.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">提取工具类</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BeanUtils </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">将</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">EntrustOrder </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">转化为我们的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">Order</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">entrustOrder</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public static  </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">entrustOrder2Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EntrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">entrustOrder) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">Order();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setOrderId(entrustOrder.getId().toString());</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setPrice(entrustOrder.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setAmount(entrustOrder.getVolume().add(entrustOrder.getDeal().negate())); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易的数量</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">= </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">总数量</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">- </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">已经成交的数量</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setSymbol(entrustOrder.getSymbol());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setOrderDirection(entrustOrder.getType().intValue());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setTime(entrustOrder.getCreated().getTime());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">8.7.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">改造代码</span></h3><h4 style="font-size:14pt; line-height:155%; margin:14pt 0pt 14.5pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:14pt; font-weight:bold">DataLoaderCmdRunner:</span></h4><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.017.png" width="520" height="318" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h4 style="font-size:14pt; line-height:155%; margin:14pt 0pt 14.5pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:14pt; font-weight:bold">MessageConsumerListener</span><span style="font-family:Arial; font-size:14pt; font-weight:bold">:</span></h4><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.018.png" width="554" height="414" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">9</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">完成限价撮合交易</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">9.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">交易流程</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.019.png" width="488" height="351" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">9.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加模型</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">9.2.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">成交记录模型</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">(ExchangeTrade)</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.020.png" width="212" height="475" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">成交记录 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">-- </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">只要成交一次</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">就产生一个记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ExchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易对</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">订单的方向</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">direction</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">本次交易的价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">price</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">本次交易的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">amount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">本次买方的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">Id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">buyOrderId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">本次出售方的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">sellOrderId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">买方的成交额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">buyTurnover</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">出售方的成交额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">sellTurnover</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">成交时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">time</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; font-weight:bold">每次撮合完成后</span><span style="font-family:Consolas; font-size:10.5pt; font-weight:bold">,</span><span style="font-family:微软雅黑; font-size:10.5pt; font-weight:bold">都会产生一个成交记录</span><span style="font-family:Consolas; font-size:10.5pt; font-weight:bold">!</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">9.2.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">盘口数据模型</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">/</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">交易数据模型</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">(TradePlate)</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.021.png" width="279" height="661" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易的盘口数据</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">以后前端可以查询该数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TradePlate </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">判断数据的详情</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">LinkedList</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TradePlateItem</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">items</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">最大支持的深度</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private int </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">maxDepth </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">100</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">订单的方向</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">direction</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易对</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">remove</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">marker, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">tradedAmount) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">盘口数据的详情</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TradePlateItem </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易的价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">price</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">amount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">9.2.3 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">将盘口数据和委托单账本绑定</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.022.png" width="427" height="328" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.023.png" width="462" height="203" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">9.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">开始撮合</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Service</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">LimitPriceMatchServiceImpl </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">InitializingBean </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">进行订单的撮合交易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">orderBooks</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">match</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderBooks </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderBooks, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">开始撮合</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 1 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">进行数据的校验</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(order.getPrice().compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) &lt;= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 2 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">获取一个挂单队列</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;&gt; markerQueueIterator = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(order.getOrderDirection() == </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">BUY</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            markerQueueIterator = orderBooks.getCurrentLimitPriceIterator(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">SELL</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            markerQueueIterator = orderBooks.getCurrentLimitPriceIterator(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">BUY</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">是否退出循环</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">boolean </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">exitLoop = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">false</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">已经完成的订单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">completedOrders </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">ArrayList&lt;&gt;();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">产生的交易记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ExchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrades </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">ArrayList&lt;&gt;();</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 3 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">循环我们的队列</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">while </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(markerQueueIterator.hasNext() &amp;&amp; exitLoop) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Entry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerOrderEntry </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= markerQueueIterator.next();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal markerPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerOrderEntry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getKey();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MergeOrder markerMergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerOrderEntry</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getValue();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">我花</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">10 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">块钱买东西</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> ,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">别人的东西如果大于</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">10 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">块</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> ,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">我就买不了</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(order.getOrderDirection() == </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">BUY </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&amp;&amp; order.getPrice().compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) &lt; </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">break</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">我出售一个东西</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> 10 ,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">结果有个人花</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">5</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">块钱</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(order.getOrderDirection() == </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">SELL </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&amp;&amp; order.getPrice().compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) &gt; </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">break</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerIterator </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerMergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.iterator();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">while </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerIterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.hasNext()) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order marker </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerIterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.next();</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ExchangeTrade exchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= processMath(order, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">marker</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, orderBooks);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrades</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.add(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(order.isCompleted()) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">经过一圈的吃单</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">我吃饱了</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">                    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">completedOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.add(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                    exitLoop = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">true</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">; </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">退出最外层的循环</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">                    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">break</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">退出当前的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">MergeOrder</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的循环</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">                </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">marker</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.isCompleted()) {</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// MergeOrder </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的一个小的订单完成了</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">                    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">completedOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.add(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">marker</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerIterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.remove();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerMergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.size() == </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// MergeOrder </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">已经吃完了</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">                </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">markerQueueIterator.remove(); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">将该</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">MergeOrder </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">从树上移除掉</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 4 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">若我们的订单没有完成</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(order.getAmount().compareTo(order.getTradedAmount()) &gt; </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            orderBooks.addOrder(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 5 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">发送交易记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">handlerExchangeTrades(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrades</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">completedOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.size() &gt; </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 6 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">发送已经成交的交易记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">completedOrders(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">completedOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">发送盘口数据</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">更新盘口</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TradePlate tradePlate </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= order.getOrderDirection() == </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">BUY </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">?</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                    orderBooks.getBuyTradePlate() : orderBooks.getSellTradePlate();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 7 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">发送盘口数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">sendTradePlateData(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">tradePlate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">进行委托单的匹配撮合交易</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">taker  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">吃单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">marker </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">挂单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @return ExchangeTrade </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ExchangeTrade </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">processMath</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">taker, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">marker, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderBooks </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderBooks) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 1 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">定义交易的变量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">成交的价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal dealPrice </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= marker.getPrice();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">成交的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">turnoverAmount = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">本次需要的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal needAmount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= calcTradeAmount(taker); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 10  20</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        // </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">本次提供给你的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal providerAmount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= calcTradeAmount(marker); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 20 10</span><br /><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">turnoverAmount = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">needAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">providerAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) &lt;= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">? </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">needAmount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">providerAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(turnoverAmount.compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) == </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">; </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">无法成交</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置本次吃单的成交数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">taker.setTradedAmount(taker.getTradedAmount().add(turnoverAmount));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal turnoverTaker </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= turnoverAmount.multiply(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">dealPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">).setScale(orderBooks.getCoinScale(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RoundingMode</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">HALF_UP</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        taker.setTurnover(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">turnoverTaker</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置本次挂单的成交数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">marker.setTradedAmount(marker.getTradedAmount().add(turnoverAmount));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal markerTurnover </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= turnoverAmount.multiply(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">dealPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">).setScale(orderBooks.getBaseCoinScale(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RoundingMode</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">HALF_UP</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        marker.setTurnover(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">markerTurnover</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ExchangeTrade exchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">ExchangeTrade();</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setAmount(turnoverAmount); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置购买的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setPrice(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">dealPrice</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置购买的价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setTime(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">System</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">currentTimeMillis</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置成交的时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setSymbol(orderBooks.getSymbol());  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置成交的交易对</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setDirection(taker.getOrderDirection());  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置交易的方法</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setSellOrderId(marker.getOrderId()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置出售方的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setBuyOrderId(taker.getOrderId()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置买方的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">id</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setBuyTurnover(taker.getTurnover()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置买方的交易额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setSellTurnover(marker.getTurnover()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">设置卖方的交易额</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(taker.getOrderDirection() == </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">BUY</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            orderBooks.getTradePlate().remove(marker, turnoverAmount);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            orderBooks.getSellTradePlate().remove(marker, turnoverAmount);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">计算本次的交易额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">calcTradeAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">order) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">order.getAmount().subtract(order.getTradedAmount());</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">发送盘口数据</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">供以后我们前端的数据更新</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">tradePlate</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">sendTradePlateData</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TradePlate </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">tradePlate) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/***</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">订单的完成</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">completedOrders</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">completedOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; completedOrders) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">System</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">out</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.println(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">本次完成的订单文</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">处理订单的记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">exchangeTrades</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">handlerExchangeTrades</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ExchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; exchangeTrades) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">System</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">out</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.println(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">交易的订单为</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">:"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">+exchangeTrades);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">afterPropertiesSet</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchServiceFactory</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">addMatchService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MatchStrategy</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">LIMIT_PRICE</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">9.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">订单是否完成的判断依据</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.024.png" width="454" height="198" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">委托单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@NoArgsConstructor</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Order </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Serializable </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">本次订单的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">Id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orderId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">用户</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">会员</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">Id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">userId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">支持的币币交易对</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">symbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">买入或卖出量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">amount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">成交量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">tradedAmount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">成交额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">turnover </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">币单位</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">coinSymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">结算单位</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">baseSymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">订单状态</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Integer </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orderStatus</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">订单的方向</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderDirection </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">挂单的价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">price </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">挂单时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">time</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易完成时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">completedTime</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易取消时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">cancelTime</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//    /**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">已经成功的水平订单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//    private List&lt;OrderDetail&gt; details;</span><br /><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    /**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">订单是否完成的判断依据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     * @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public boolean </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">isCompleted</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">amount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.compareTo(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">tradedAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) &lt;= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">9.5 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">委托单新增数据或删除数据时更新盘口</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">在</span><span style="font-family:Consolas; font-size:10.5pt">OrderBooks </span><span style="font-family:微软雅黑; font-size:10.5pt">里面</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">怎么添加一个订单进入我们的队列里面</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">addOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">currentLimitPrices </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= getCurrentLimitPrices(order.getOrderDirection());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">mergeOrder = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">currentLimitPrices</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.get(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(mergeOrder == </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">之前在红黑树里面没有这个价格的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">key</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">mergeOrder = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">MergeOrder();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">currentLimitPrices</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.put(order.getPrice(), mergeOrder);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">mergeOrder.add(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><br /><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">    </span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-style:italic; font-weight:bold">// </span><span style="background-color:#ffffff; color:#0000ff; font-family:宋体; font-size:10pt; font-style:italic; font-weight:bold">添加到盘点里面</span><br /><span style="background-color:#ffffff; color:#0000ff; font-family:宋体; font-size:10pt; font-style:italic; font-weight:bold">    </span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">if (order.getOrderDirection() == OrderDirection.</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-style:italic; font-weight:bold">BUY</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">) {</span><br /><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">        buyTradePlate.add(order);</span><br /><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">    } else {</span><br /><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">        sellTradePlate.add(order);</span><br /><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:10pt; font-weight:bold">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">怎么取消一个订单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">cancelOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TreeMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">currentLimitPrices </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= getCurrentLimitPrices(order.getOrderDirection());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MergeOrder mergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">currentLimitPrices</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.get(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mergeOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">== </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.iterator();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">while </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.hasNext()) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order next </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.next();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">找到之前的我们的订单记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">next</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getOrderId().equals(order.getOrderId())) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.remove();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">int </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">size </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">mergeOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.size(); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">删除之前</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">我们看合并订单的大小</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">size </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">== </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">若我们的红黑树里面的合并订单的数据为空</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">我们摘除</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">currentLimitPrices</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.remove(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic; font-weight:bold">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic; font-weight:bold">添加到盘点里面</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic; font-weight:bold">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt; font-weight:bold">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">(order.getOrderDirection() == </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt; font-weight:bold">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic; font-weight:bold">BUY</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-weight:bold">buyTradePlate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">.remove(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">    } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt; font-weight:bold">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-weight:bold">sellTradePlate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">.remove(order);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-weight:bold">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">9.6 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">盘口数据的添加和删除</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">添加订单数据到盘口数据里面</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">当我们新增一个委托单时</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">它没有全部的成交 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">因此把它展示在盘口里面</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">add</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(order.getOrderDirection() != </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">direction</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">int </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">i = </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">for </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(i = </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">; i &lt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">items</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.size(); i++) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// 1 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">我们的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">sell </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">队列是</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">从小到大</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// 2 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">我们的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">buy </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">队列是</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">从大到小</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">DepthItemVo depthItemVo </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">items</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.get(i);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                (</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">direction </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">== </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">BUY </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&amp;&amp; order.getPrice().compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">depthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getPrice()) == -</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                        ||</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                        (</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">direction </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">== </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderDirection</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">SELL </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&amp;&amp; order.getPrice().compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">depthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getPrice()) == </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        ) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">还不能插入</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">往前走一步</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">continue</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">else if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">depthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getPrice().compareTo(order.getPrice()) == </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">depthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setVolume(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">depthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getVolume().add(order.getAmount().subtract(order.getTradedAmount())));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">break</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">; </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">我就想插入 当前我就在第</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> i</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(i &lt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">maxDepth</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">DepthItemVo depthItemVo </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">DepthItemVo();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">depthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setPrice(order.getPrice());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">depthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setVolume(order.getAmount().subtract(order.getTradedAmount()));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">items</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.add(i, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">depthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">从盘口里面移除订单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">remove</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">order) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// order.getAmount().subtract(order.getTradedAmount() </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">成交的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">remove(order, order.getAmount().subtract(order.getTradedAmount()));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/***</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">从盘口里面移除数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">order</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">amount</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">remove</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">order, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">amount) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">items</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.size() == </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(order.getOrderDirection() != </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">direction</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">DepthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">items</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.iterator();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">while </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.hasNext()) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">DepthItemVo next </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.next();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(order.getPrice().compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">next</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getPrice()) == </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">价格相同</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">next</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.setVolume(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">next</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getVolume().subtract(amount));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">next</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getVolume().compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) &lt;= </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:8pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">iterator</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.remove(); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">若价格为</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> 0 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">后</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">我们直接可以摘掉它</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">9.7 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">处理数据的发送</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">9.7.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">添加</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">Source</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public interface </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Source </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">盘口数据的输出</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Output</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"trade_plate_out"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageChannel </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">plateOut</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() ;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">完成订单数据的输出</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Output</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"completed_orders_out"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageChannel </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">completedOrdersOut</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() ;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">交易记录的输入</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Output</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"exchange_trades_out"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageChannel </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">exchangeTradesOut</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">9.7.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">添加配置文件</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.025.png" width="554" height="174" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">9.7.3 Source</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">注入</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">开启我们的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">Stream</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的开发</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Configuration</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@EnableBinding</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(value = {</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Sink</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}) </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RocketStreamConfig </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">9.7.3 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">数据的发送</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">在</span><span style="font-family:Consolas; font-size:10.5pt">LimitPriceMatchServiceImpl </span><span style="font-family:微软雅黑; font-size:10.5pt">里面</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.026.png" width="468" height="155" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">发送盘口数据</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">供以后我们前端的数据更新</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">tradePlate</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">sendTradePlateData</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TradePlate </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">tradePlate) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">TradePlate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">message </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageBuilder</span><br /><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">                    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">withPayload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(tradePlate)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .setHeader(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageHeaders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">CONTENT_TYPE</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MimeTypeUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">APPLICATION_JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .build();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.plateOut().send(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/***</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">订单的完成</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">completedOrders</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">completedOrders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; completedOrders) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Order</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt;&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">message </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageBuilder</span><br /><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">withPayload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(completedOrders)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            .setHeader(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageHeaders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">CONTENT_TYPE</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MimeTypeUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">APPLICATION_JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            .build();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.completedOrdersOut().send(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">处理订单的记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">exchangeTrades</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">handlerExchangeTrades</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">ExchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt; exchangeTrades) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">ExchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt;&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">message </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageBuilder</span><br /><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">withPayload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(exchangeTrades)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            .setHeader(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MessageHeaders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">CONTENT_TYPE</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">MimeTypeUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">APPLICATION_JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            .build();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt">source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.exchangeTradesOut().send(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) ;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">10</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:Consolas; font-size:22pt; font-weight:bold">Bug </span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">解决</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">10.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">盘口数据的初始化</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.027.png" width="554" height="271" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">10.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">发送一个</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">Null</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">的集合</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.028.png" width="502" height="305" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">11</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">完成盘口数据的查询操作</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">10.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">修改盘口数据的模型</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">将之前的</span><span style="font-family:Consolas; font-size:10.5pt">:TradePlateItem </span><span style="font-family:微软雅黑; font-size:10.5pt">修改为我们之前在</span><span style="font-family:Consolas; font-size:10.5pt">exchange-service </span><span style="font-family:微软雅黑; font-size:10.5pt">里面构造的</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">DepthItemVo </span><span style="font-family:微软雅黑; font-size:10.5pt">对象</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.029.png" width="430" height="278" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">将</span><span style="font-family:Consolas; font-size:10.5pt">DepthItemVo  </span><span style="font-family:微软雅黑; font-size:10.5pt">提取到</span><span style="font-family:Consolas; font-size:10.5pt">common </span><span style="font-family:微软雅黑; font-size:10.5pt">包里面</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.030.png" width="300" height="241" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">这样</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">他们就能共享了这个公共的类了</span><span style="font-family:Consolas; font-size:10.5pt">.</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">10.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">在</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">match-api </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">里面添加</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">feign</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">客户端</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@FeignClient</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(name = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"match-service"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, contextId = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"orderBooksFeignClient"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, configuration = </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OAuth2FeignConfig</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">class</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public interface </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">OrderBooksFeignClient </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">远程调用深度数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">symbol</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@GetMapping</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"/match/depth"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">DepthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">&gt;&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">getDepth</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(required = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">true</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">symbol) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">10.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">在</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">match-service</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">的</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">MatchController</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">里面实现它</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.031.png" width="554" height="90" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DepthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getDepth</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(required = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">true</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">symbol) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DepthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depths </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">HashMap&lt;&gt;();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">for </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEvent</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">eventHandler </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">eventHandlers</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEventHandler orderEventHandler </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= (</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderEventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">eventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">找到对应的深度数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderEventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getSymbol().equals(symbol)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">OrderBooks orderBooks </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderEventHandler</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getOrderBooks();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TradePlate buyTradePlate </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderBooks</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getBuyTradePlate();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TradePlate sellTradePlate </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">orderBooks</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getSellTradePlate();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depths</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"bids"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">buyTradePlate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getItems());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depths</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"asks"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">sellTradePlate</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getItems());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depths</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">10.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">在</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">MarketController</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">修改</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">findDeptVosSymbol</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">方法</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">Tip: </span><span style="font-family:微软雅黑; font-size:10.5pt">在</span><span style="font-family:Consolas; font-size:10.5pt">exchange-service </span><span style="font-family:微软雅黑; font-size:10.5pt">里面添加</span><span style="font-family:Consolas; font-size:10.5pt">match-api</span><span style="font-family:微软雅黑; font-size:10.5pt">的依赖</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.032.png" width="426" height="164" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@ApiOperation</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(value = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">通过的交易对以及深度查询当前的市场的深度数据</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@GetMapping</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"/depth/{symbol}/{dept}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@ApiImplicitParams</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">({</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@ApiImplicitParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(name = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"symbol"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, value = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">交易对</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">),</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@ApiImplicitParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(name = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"dept"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, value = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">深度类型</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">),</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">})</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">R</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DepthsVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">findDeptVosSymbol</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@PathVariable</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"symbol"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">symbol, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">dept) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">交易市场</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Market market </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">marketService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getMarkerBySymbol(symbol);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DepthsVo depthsVo </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">DepthsVo();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthsVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setCnyPrice(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">market</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getOpenPrice()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// CNY</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthsVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setPrice(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">market</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getOpenPrice()); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// GCN</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的价格</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">DepthItemVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt;&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthMap </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">orderBooksFeignClient</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getDepth(symbol);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">CollectionUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">isEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthsVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setAsks(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.get(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"asks"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthsVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setBids(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthMap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.get(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"bids"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">R</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">ok</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">depthsVo</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">10.5 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加委托单演示</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">测试之前</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">先清除数据库的的这个数据</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.033.png" width="554" height="129" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">可以自己添加和删除测试</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.034.png" width="254" height="448" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">12</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">撮合完成</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">12.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">撮合完成需要更新数据库的值</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.035.png" width="553" height="674" alt="数据的流转" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">12.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">公共类的提取</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">将</span><span style="font-family:Consolas; font-size:10.5pt">ExchangeTrade </span><span style="font-family:微软雅黑; font-size:10.5pt">和</span><span style="font-family:Consolas; font-size:10.5pt">OrderDirection </span><span style="font-family:微软雅黑; font-size:10.5pt">提取到</span><span style="font-family:Consolas; font-size:10.5pt">common</span><span style="font-family:微软雅黑; font-size:10.5pt">模块</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.036.png" width="363" height="418" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">12.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">使用</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">Rocket</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">接收撮合数据</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">12.3.1 Sink</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">数据的接收</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">public interface </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Sink </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">交易数据的输入</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@Input</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"exchange_trade_in"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">MessageChannel </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10.5pt">exchangeTradeIn</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">}</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">12.3.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">监听器</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:11pt; font-style:italic">/***</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:11pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:11pt; font-style:italic">交易数据的监听</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:11pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:11pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:11pt">@Component</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:11pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:11pt">ExchangeTradeListener </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:11pt">@Autowired</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:11pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:11pt">EntrustOrderService </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:11pt">entrustOrderService </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:11pt">@Transactional</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:11pt">    @StreamListener</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:11pt">"exchange_trade_in"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:11pt">receiveExchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:11pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:11pt">ExchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt; exchangeTrades){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:11pt">CollectionUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt; font-style:italic">isEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">(exchangeTrades)){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">for </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:11pt">ExchangeTrade exchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">: exchangeTrades) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">if</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:11pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">!=</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">                </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:11pt; font-style:italic">//  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:11pt; font-style:italic">交易完成后</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:11pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:11pt; font-style:italic">去更新我们的数据库</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:11pt; font-style:italic">                </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:11pt">entrustOrderService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">.doMatch(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:11pt">exchangeTrade</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">        }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">}</span></p><p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">12.3.3 EntrustOrderService</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">接口</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">更新我们的委托单的数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">exchangeTrade</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10.5pt">doMatch</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">ExchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">exchangeTrade);</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">12.3.4 EntrustOrderServiceImpl</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">更新我们的委托单的数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic">exchangeTrade</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Transactional</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">doMatch</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">ExchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">exchangeTrade) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String sellOrderId </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= exchangeTrade.getSellOrderId();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String buyOrderId </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= exchangeTrade.getBuyOrderId();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder sellOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= getById(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellOrderId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder buyOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= getById(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyOrderId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Long marketId </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.getMarketId();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Market market </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">marketService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.getById(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">marketId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// 1 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">新增成交记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">addTurnOverOrderRecord(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">market</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, exchangeTrade);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// 2 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">更新委托单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">updateEntrustOrder(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">, exchangeTrade);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// 3 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">余额的返还</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">rollBackAccount(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">,exchangeTrade,</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">market</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span><br /><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">添加成交记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * @param</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> */</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">addTurnOverOrderRecord</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sellOrder, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">buyOrder, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Market </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">market, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">ExchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">exchangeTrade) {</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">出售订单的成交记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">TurnoverOrder sellTurnoverOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">TurnoverOrder();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setSellOrderId(sellOrder.getId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyCoinId(buyOrder.getId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyVolume(exchangeTrade.getAmount());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setAmount(exchangeTrade.getSellTurnover());</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyCoinId(market.getBuyCoinId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setSellCoinId(market.getSellCoinId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setCreated(</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">Date());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyUserId(buyOrder.getUserId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setSellUserId(sellOrder.getUserId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setPrice(exchangeTrade.getPrice()) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyPrice(buyOrder.getPrice()) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setTradeType(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">turnoverOrderService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.save(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">买方数据的成交记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">TurnoverOrder buyTurnoverOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">TurnoverOrder();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyOrderId(buyOrder.getId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setSellOrderId(sellOrder.getId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setAmount(exchangeTrade.getBuyTurnover());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyVolume(exchangeTrade.getAmount());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setSellUserId(sellOrder.getUserId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyUserId(buyOrder.getUserId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setSellCoinId(market.getSellCoinId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setBuyCoinId(market.getBuyCoinId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setCreated(</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">Date());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.setTradeType(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">turnoverOrderService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.save(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">sellTurnoverOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">更新委托单记录</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic">exchangeTrade</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">updateEntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sellOrder, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">buyOrder, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">ExchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">exchangeTrade) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">已经成交的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sellOrder.setDeal(exchangeTrade.getAmount());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    buyOrder.setDeal(exchangeTrade.getAmount());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal volume </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= sellOrder.getVolume(); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">总的数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal amount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= exchangeTrade.getAmount(); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">本次成交的数量</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">amount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">volume</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) == </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">交易完成</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">状态</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">(</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">已经完成</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">)</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sellOrder.setStatus((</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">byte</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">BigDecimal buyOrderVolume </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">= buyOrder.getVolume();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">buyOrderVolume</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.compareTo(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">volume</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) == </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">0</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) { </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">交易完成</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">状态</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">(</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">已经完成</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">)</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">buyOrder.setStatus((</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">byte</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:10pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">更新委托单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">updateById(sellOrder);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    updateById(buyOrder);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span><br /><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">返回账户的余额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic">exchangeTrade</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">rollBackAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sellOrder, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">EntrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">buyOrder, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">ExchangeTrade </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">exchangeTrade, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Market </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">market) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">买单需要返还用户的余额</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">,</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">之前扣减的余额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">accountServiceFeign</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.transferBuyAmount(buyOrder.getUserId(),     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">买单用户</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">ID</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sellOrder.getUserId(),                          </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">卖单用户</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">ID</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">market.getBuyCoinId(),                           </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">买单支付币种</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">exchangeTrade.getBuyTurnover(),                      </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">买单成交金额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:10pt">币币交易</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">,</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Long</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt; font-style:italic">valueOf</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(exchangeTrade.getBuyOrderId()));</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">出售单需要</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">accountServiceFeign</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.transferSellAmount(sellOrder.getUserId(),    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">卖单用户</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">ID</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">sellOrder.getUserId(),                           </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">买单用户</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">ID</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">market.getSellCoinId(),                          </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">卖单支付币种</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">exchangeTrade.getSellTurnover(),                                      </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">卖单成交数量</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:10pt">币币交易</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">,                        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">业务类型：币币交易撮合成交</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Long</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt; font-style:italic">valueOf</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">( exchangeTrade.getSellOrderId()));                         </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">成交订单</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">ID</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">12.3.5 AccountServiceFeign</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">划转买入的账户余额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">fromUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">toUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">coinId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">amount</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">businessType</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">orderId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@PostMapping</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"/transferBuyAmount"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10.5pt">transferBuyAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"fromUserId"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">fromUserId, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"toUserId"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">toUserId, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"coinId"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">coinId, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"amount"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">amount,</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"businessType"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">businessType, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"orderId"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">orderId);</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic"> *  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">划转出售的成功的账户余额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">fromUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">toUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">coinId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">amount</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">businessType</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">orderId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@PostMapping</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"/transferSellAmount"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10.5pt">transferSellAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"fromUserId"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">fromUserId, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"toUserId"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">toUserId, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"coinId"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">coinId, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"amount"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">amount,</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"businessType"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">businessType, </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10.5pt">@RequestParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10.5pt">"orderId"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">)</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">orderId);</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">12.3.6 AccountController</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">划转买入的账户余额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">fromUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">toUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">coinId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">amount</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">businessType</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">orderId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">transferBuyAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">fromUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">toUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">businessType, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderId) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">accountService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.transferBuyAmount(fromUserId, toUserId, coinId, amount, businessType, orderId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">划转出售的成功的账户余额</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">fromUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">toUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">coinId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">amount</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">businessType</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">orderId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">transferSellAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">fromUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">toUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">businessType, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderId) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">accountService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.transferSellAmount(fromUserId, toUserId, coinId, amount, businessType, orderId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">12.3.7 AccountService</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> *</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">fromUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">toUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">coinId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">amount</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">businessType</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">orderId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">transferBuyAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">fromUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">toUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">businessType, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderId);</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> *</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">fromUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">toUserId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">coinId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">amount</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">businessType</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">orderId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">transferSellAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">fromUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">toUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">businessType, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderId);</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">12.3.8 AccountServiceImpl</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">transferBuyAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">fromUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">toUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">businessType, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderId) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Account fromAccount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= getCoinAccount(coinId, fromUserId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">== </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.error(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金划转</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">-</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金账户异常，</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">userId:{}, coinId:{}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, fromUserId, coinId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">IllegalArgumentException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金账户异常</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Account toAccount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= getCoinAccount(toUserId, coinId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">== </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">IllegalArgumentException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金账户异常</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">boolean </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">count1 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= decreaseAmount(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, amount);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">boolean </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">count2 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= addAmount(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, amount);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">count1 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&amp;&amp; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">count2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">AccountDetail</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">ArrayList(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">AccountDetail fromAccountDetail </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">AccountDetail(fromUserId, coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId(), orderId, </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, businessType, amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, businessType);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">AccountDetail toAccountDetail </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">AccountDetail(toUserId, coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId(), orderId, </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, businessType, amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, businessType);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.add(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccountDetail</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.add(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccountDetail</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.addAll(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">RuntimeException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金划转失败</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span><br /><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private boolean </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">addAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Account </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">account, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">amount) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    account.setBalanceAmount(account.getBalanceAmount().add(amount));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">updateById(account);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span><br /><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private boolean </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">decreaseAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Account </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">account, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">amount) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    account.setBalanceAmount(account.getBalanceAmount().subtract(amount));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">updateById(account);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span><br /><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">transferSellAmount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">fromUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">toUserId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">businessType, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderId) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Account fromAccount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= getCoinAccount(coinId, fromUserId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">== </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.error(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金划转</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">-</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金账户异常，</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">userId:{}, coinId:{}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, fromUserId, coinId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">IllegalArgumentException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金账户异常</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Account toAccount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= getCoinAccount(toUserId, coinId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccount </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">== </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">IllegalArgumentException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金账户异常</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">boolean </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">count1 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= addAmount(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, amount);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">boolean </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">count2 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= decreaseAmount(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, amount);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">count1 </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&amp;&amp; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">count2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">List</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">AccountDetail</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">ArrayList(</span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">AccountDetail fromAccountDetail </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">AccountDetail(fromUserId, coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId(), orderId, </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, businessType, amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, businessType);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">AccountDetail toAccountDetail </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">AccountDetail(toUserId, coinId, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccount</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId(), orderId, </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">1</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, businessType, amount, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">BigDecimal</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">ZERO</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, businessType);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.add(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">fromAccountDetail</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.add(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">toAccountDetail</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.addAll(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accountDetails</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throw new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">RuntimeException(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">资金划转失败</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">13</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">订单的取消</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">13.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">取消思路</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.037.png" width="554" height="439" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">以上的过程都是单线程的</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">但是因为添加取消后</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">情况可能会发生变化</span><span style="font-family:Consolas; font-size:10.5pt">.</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">13.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">取消的实现</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">(</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">思路</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">)</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">13.2.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">接收取消的请求</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; font-weight:bold">EntrustOrderController:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@ApiOperation</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(value = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:10pt">委托单的取消操作</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">)</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@ApiImplicitParams</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">({</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@ApiImplicitParam</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(name = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"id" </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">,value = </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:10pt">委托单的</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">id"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">})</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@DeleteMapping</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"/{id}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">R </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">deleteEntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@PathVariable</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"id"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">orderId){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">entrustOrderService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.cancleEntrustOrder(orderId) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">R</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt; font-style:italic">ok</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:10pt">取消成功</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; font-weight:bold">EntrustOrderService</span><span style="font-family:Consolas; font-size:10.5pt; font-weight:bold">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.038.png" width="516" height="135" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; font-weight:bold">EntrustOrderService</span><span style="font-family:Consolas; font-size:10.5pt; font-weight:bold">Impl:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">cancleEntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderId) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">取消委托单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 1 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">将该委托单从撮合引擎里面的委托单账本里面移除</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EntrustOrder entrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">EntrustOrder();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setStatus((</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">byte</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setId(orderId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EntrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">message </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MessageBuilder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">withPayload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">).setHeader(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MessageHeaders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">CONTENT_TYPE</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">MimeTypeUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">APPLICATION_JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">).build();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">source</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.outputMessage().send(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">13.2.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">从委托单账本里面移除</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">在撮合系统里面的</span><span style="font-family:Consolas; font-size:10.5pt">MessageConsumerListener</span><span style="font-family:微软雅黑; font-size:10.5pt">处理该消息</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.039.png" width="494" height="368" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">从账单本上取消</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.040.png" width="553" height="223" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">13.2.3 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">移除成功后</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">,</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">更新数据库</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="ed63ddf9-8285-4359-98a2-50771b23b654.041.png" width="491" height="320" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">监听取消队列的消息</span><span style="font-family:Consolas; font-size:10.5pt">:ExchangeTradeListener:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Transactional</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@StreamListener</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"cancel_order_in"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">receiveCancelOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">orderId){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">entrustOrderService</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.cancleEntrustOrderToDb(orderId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">13.2.4 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">执行数据库的取消操作</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; font-weight:bold">EntrustOrderService:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic">数据库里面委托单的取消</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic">orderId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:10.5pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10.5pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10.5pt">void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10.5pt">cancleEntrustOrderToDb</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10.5pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10.5pt">orderId);</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:11pt; font-weight:bold">EntrustOrderServiceImpl:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">数据库里面委托单的取消</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">orderId</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">cancleEntrustOrderToDb</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">orderId) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 2 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">数据库的操作</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">StringUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">hasText</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(orderId)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long orderIdVal </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">valueOf</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(orderId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">EntrustOrder entrustOrder </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= getById(orderId);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setStatus((</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">byte</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">2</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        updateById(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">entrustOrder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">13.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">配置文件</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">13.3.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">交易引擎的配置文件</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">spring</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">application</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">name</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: exchange-service</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">cloud</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"># nacos</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">地址</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">nacos</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">server-addr</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: nacos-server:8848</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">config</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">file-extension</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: yaml</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">stream</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">rocketmq</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">binder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">          </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">name-server</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: rocket-server:9876  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">#/RocketMQ Message hasn't been sent</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">binders</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">          </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">order_out</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">consumer.orderly</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: true}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">bindings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">order_out</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: order_in, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: application/plain}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">cancel_order_in</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: cancel_order_out, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: application/plain, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">group</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: order-group, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">consumer.maxAttempts</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: 1}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">exchange_trade_in</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: exchange_trades_out, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: application/plain, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">group</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: order-group, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">consumer.maxAttempts</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: 1}</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">拉取的配置文件的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">dataID =  exchange-service-dev.yaml</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">profiles</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">active</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">: dev</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">13.3.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">撮合引擎的配置文件</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">spring</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">application</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">name</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: match-service</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">profiles</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">active</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: dev</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">cloud</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">nacos</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">server-addr</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: nacos-server:8848</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">config</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">file-extension</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: yaml</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">stream</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">bindings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">order_in</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: order_in, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: application/plain, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">group</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: order-group, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">consumer.maxAttempts</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: 1}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">trade_plate_out</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: trade_plate_out, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: application/plain}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">completed_orders_out</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: completed_orders_out, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: application/plain}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">exchange_trades_out</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: exchange_trades_out, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: application/plain}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">cancel_order_out</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: {</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">destination</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: cancel_order_out, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">content-type</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: application/plain}</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">rocketmq</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">binder</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">          </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">name-server</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: rocket-server:9876</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">#      </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">去</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> nacos-server </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">里面拉取</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> match-service-dev.yaml</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">match</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">symbols</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">BTCGCN</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">coinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: 8</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">baseCoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: 8</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">ETHGCN</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">coinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: 8</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">baseCoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: 8</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">FOFTGCN</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">coinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: 8</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">baseCoinScale</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: 8</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p></div><div class="cnzz" style="display: none;">
	        <script src="https://s23.cnzz.com/z_stat.php?id=1277655852&web_id=1277655852" language="JavaScript"></script>
            </div>
            <div class="docpe" style="position: absolute;color: white;margin-left:-450;">
            <a target="_blank" href="http://www.docpe.com">档铺网——在线文档免费处理</a>
            </div>
            </body></html>